// JavaScript Document

//登陆页面的js
$(document).ready(
	 function(){
		   $("#sub").hover( function() {
			    $(this).css("background-color","#ff936a");
				},
				 function(){
					  $(this).css("background-color","#ff6f3d");
					  })
				});
$(document).ready(
	 function(){
		 $("#bt").hover( function() {
			 $(this).css("color","black");},
			 function(){
				 $(this).css("color","#999");
				 })
		});
function changeP(){
	$("#pwd").css("display","block");
	$("#pwdtext").css("display","none");
	document.getElementById("pwd").focus();
	}
function changeP2(){
	$("#pwd2").css("display","block");
	$("#pwdtext2").css("display","none");
	document.getElementById("pwd2").focus();
	}
function changeP3(){
	$("#pwd3").css("display","block");
	$("#pwdtext3").css("display","none");
	document.getElementById("pwd3").focus();
	}
function changeU(){
	$("#user").css("display","block");
	$("#usertext").css("display","none");
	document.getElementById("user").focus();
	}
function checkUser1(){
	
  var us=document.getElementById("user").value;
  var ustext= document.getElementById("usertext");
 
  //var regus=/^(\w+@\w+(\.[a-zA-Z]{2,3}){1,2})|(1[3,4,5,7,8]\d{9})$/;//"(^[\w.\-]+@(?:[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*\.)+[A-Za-z]{2,6}$)|(^1\d{10}$)|(^\d{3,}$)|(^\++\d{2,}$)"
  var regus=/^[0-9]{11}$/;
  if(regus.test(us)==false){
	  $("#user").css("display","none");
		$("#usertext").css("display","block");
	   document.getElementById("usertext").focus();
	  ustext.value="账号为您的电话号码";
     return false;
  }
  return true;
}
function checkPwd1(){
  var p=document.getElementById("pwd").value;
  var ptext= document.getElementById("pwdtext");
 
  var reg=/^[0-9]{6}$/;
  if(reg.test(p)==false){
	  $("#pwd").css("display","none");
	$("#pwdtext").css("display","block");
	document.getElementById("pwdtext").focus();
	 ptext.value="密码只能为6位数字";
	  
     return false;
  }
  return true;
}
function checkPwd2(){
  var p=document.getElementById("pwd2").value;
  var ptext= document.getElementById("pwdtext2");

  var reg=/^[0-9]{6}$/;
  if(reg.test(p)==false){
	  $("#pwd2").css("display","none");
	$("#pwdtext2").css("display","block");
	document.getElementById("pwdtext2").focus();
	 ptext.value="新密码只能为6位数字";

     return false;
  }
  return true;
}
function checkPwd3(){
  var p=document.getElementById("pwd3").value;
  var ptext= document.getElementById("pwdtext3");

  var reg=/^[0-9]{6}$/;
  if(reg.test(p)==false){
	  $("#pwd3").css("display","none");
	$("#pwdtext3").css("display","block");
	document.getElementById("pwdtext3").focus();
	 ptext.value="新密码只能为6位数字";

     return false;
  }
  return true;
}

function checkLogin(){
	if(checkUser1()&&checkPwd1()){
		return true;
		}
		else{ 
			//$("#usertext").css("display","block");
			//$("#pwdtext").css("display","block");
			return false;}
	}
function checkModify(){
	if(checkPwd1()&&checkPwd2()&&checkPwd3()){
		return true;
		}
		else{
			//$("#usertext").css("display","block");
			//$("#pwdtext").css("display","block");
			return false;}
	}


//重置的页面js

 $(document).ready(
				  function(){
					  $("#rebtu").hover( function() {
												      $(this).css("background-color","#ff936a");
													   },
													   function(){
														    $(this).css("background-color","#ff6f3d");
														   }
													   )
					  }
				);

function checkLopwd(){
  var lopwd=document.getElementById("lopwd").value;
  var  errlopwd=document.getElementById("errlopwd");
  var reg=/^[a-zA-Z0-9]{6,10}$/;
  if(lopwd==""||lopwd.length==0){
	  $("#errlopwd").css("display","block");
	  errlopwd.innerHTML="Old password not null";
	  return false;
	  }
	   
else  if(reg.test(lopwd)==false){
	 
	   errlopwd.innerHTML="Password wrong";
     return false;
  }else{
			 errlopwd.innerHTML="";
			errlopwd.style.display="none";
			 }
 
  return true;
}
function checkRelopwd(){
  var relopwd=document.getElementById("relopwd").value;
  var errrelopwd= document.getElementById("errrelopwd");
 
  var reg=/^[a-zA-Z0-9]{6,10}$/;
  if(relopwd==""||relopwd.length==""){
	  $("#errrelopwd").css("display","block");
	  errrelopwd.innerHTML="Password not null";
	  return false;
	  }
 else if(reg.test(relopwd)==false){
  
	errrelopwd.innerHTML="Password format wrong";
	  
     return false;
  }else{
			 errrelopwd.innerHTML="";
			errrelopwd.style.display="none";
			 }
  return true;
}
function check2(){
	if(checkLopwd()&&checkRelopwd()){
		return true;
		}
		else{ 
		 
			return false;}
	}